/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketmaster.businessobject;

import java.sql.Timestamp;
import ticketmaster.common.SeatCategories;
import ticketmaster.dataobject.TicketRate;

/**
 *
 * @author Wei Liu
 */
public class Ticket
{
    private int customerID;
    private TicketRate ticketRate;
    private SeatBO seat;
    private Timestamp bookedDate;
    private boolean isCancelled;
    private boolean isPaid;
    private int transactionID;

    @Override
    public boolean equals(Object o)
    {
        boolean isEqual = true;
        Ticket obj = (Ticket) o;

        if(this.ticketRate.getEventID() != obj.getTicketRate().getEventID())
            isEqual = false;
        if(this.ticketRate.getPrice() != obj.getTicketRate().getPrice())
            isEqual = false;
        if(this.ticketRate.getSeatCategoryID() != obj.getTicketRate().getSeatCategoryID())
            isEqual = false;
        if(this.ticketRate.getVenueID() != obj.getTicketRate().getVenueID())
            isEqual = false;
        if(this.isCancelled != obj.isCancelled)
            isEqual = false;
        if(this.isPaid != obj.isPaid)
            isEqual = false;
//        if(this.bookedDate != obj.bookedDate)
//            isEqual = false;
        if(this.customerID != obj.customerID)
            isEqual = false;
        if(this.seat.getSeatNumber() != obj.seat.getSeatNumber())
            isEqual = false;
        if(this.transactionID != obj.transactionID)
            isEqual = false;

        return isEqual;
    }

    /**
     * @return the ticketRate
     */
    public TicketRate getTicketRate()
    {
        return ticketRate;
    }

    /**
     * @param ticketRate the ticketRate to set
     */
    public void setTicketRate(TicketRate ticketRate)
    {
        this.ticketRate = ticketRate;
    }

    /**
     * @return the customerID
     */
    public int getCustomerID()
    {
        return customerID;
    }

    /**
     * @param customerID the customerID to set
     */
    public void setCustomerID(int CustomerID)
    {
        this.customerID = CustomerID;
    }

    /**
     * @return the bookedDate
     */
    public Timestamp getBookedDate()
    {
        return bookedDate;
    }

    /**
     * @param bookedDate the bookedDate to set
     */
    public void setBookedDate(Timestamp bookedDate)
    {
        this.bookedDate = bookedDate;
    }

    /**
     * @return the isCancelled
     */
    public boolean isIsCancelled()
    {
        return isCancelled;
    }

    /**
     * @param isCancelled the isCancelled to set
     */
    public void setIsCancelled(boolean isCancelled)
    {
        this.isCancelled = isCancelled;
    }

    /**
     * @return the isPaid
     */
    public boolean isIsPaid()
    {
        return isPaid;
    }

    /**
     * @param isPaid the isPaid to set
     */
    public void setIsPaid(boolean isPaid)
    {
        this.isPaid = isPaid;
    }

    /**
     * @return the transactionID
     */
    public int getTransactionID()
    {
        return transactionID;
    }

    /**
     * @param transactionID the transactionID to set
     */
    public void setTransactionID(int transactionID)
    {
        this.transactionID = transactionID;
    }

    /**
     * @return the seat
     */
    public SeatBO getSeat()
    {
        return seat;
    }

    /**
     * @param seat the seat to set
     */
    public void setSeat(SeatBO seat)
    {
        this.seat = seat;
    }

    @Override
    public String toString()
    {
        return SeatCategories.getSeatCategory(this.getTicketRate().getSeatCategoryID());
    }
}
